import $ajax from '../ajax'
import {
  baseUrl,
  adUrl,
  adConfig,
  channelUrl,
  fingerprintUrl,
  hlAdLogUrl,
  pkgChannel,
  appSource
} from '../config'
import md5 from 'crypto-js/md5'
import { setGlobalData, getGlobalData } from '../../global'
/**
 * @desc 在实际开发中，您可以将 baseUrl 替换为您的请求地址前缀；
 *
 * 已将 $apis 挂载在 global，您可以通过如下方式，进行调用：
 * $apis.example.getApi().then().catch().finally()
 *
 */
const jisuKey = 'd1523b388cafe716'
export default {
  //协议
  getProtocol() {
    const data = {
      appSource: appSource,
      channel: pkgChannel
    }
    return $ajax.post(`${baseUrl}/config/getProtocolConfig`, data, {
      auth: false
    })
  },
  getMonthlyList(data) {
    return $ajax.get(`${baseUrl}/user-account-books/monthlyList`, data)
  },
  booksCreate(data) {
    return $ajax.post(`${baseUrl}/user-account-books/create`, data)
  },
  getUnit(data) {
    return $ajax.get(`https://api.jisuapi.com/unitconvert/unit`, {
      ...data,
      appkey: jisuKey
    })
  },
  getUnitConvert(data) {
    return $ajax.get(`https://api.jisuapi.com/unitconvert/convert`, {
      ...data,
      appkey: jisuKey
    })
  },
  getExchange(data) {
    return $ajax.get(`https://api.jisuapi.com/exchange/currency`, {
      ...data,
      appkey: jisuKey
    })
  },
  getExchangeConvert(data) {
    return $ajax.get(`https://api.jisuapi.com/exchange/convert`, {
      ...data,
      appkey: jisuKey
    })
  },
  delBill(data) {
    return $ajax.post(`${baseUrl}/user-account-books/del/${data}`, {})
  },
  updateBill(data) {
    return $ajax.post(`${baseUrl}/user-account-books/update`, data)
  },
  feedbackAdd(data) {
    return $ajax.post(`${baseUrl}/feedback/add`, {
      ...data,
      channel: pkgChannel
    })
  },
  userReportAdd(data) {
    return $ajax.post(`${baseUrl}/userReport/add`, {
      ...data,
      channel: pkgChannel
    })
  },
  getXhySearch(data) {
    return $ajax.get(`https://api.jisuapi.com/xhy/search`, {
      ...data,
      appkey: jisuKey
    })
  },
  getCmySearch(data) {
    return $ajax.get(`https://api.jisuapi.com/miyu/search`, {
      ...data,
      appkey: jisuKey
    })
  }
}
